
export default {
  ws: {},
  eventBus: {},
  setWs: function(newWs) {
    this.ws = newWs
  },
  subEventHandler: function(evtName, evtHandler) {
    console.log('---订阅事件---  ', evtName, evtHandler)
    const handlerList = this.eventBus[evtName]
    if (handlerList === undefined) {
      this.eventBus[evtName] = [evtHandler]
    } else {
      if (!(evtHandler in handlerList)) {
        handlerList.push(evtHandler)
      }
    }
  }
}
